import React, { Component } from "react";
import "./Header.less";
import {Link,withRouter} from "react-router-dom"
// css BEM命名 eg:header-left-text
 class Header extends Component {
  render() {
    let { back, register, title } = this.props;
    return (
      <div className="header">
        {back ? <div className="back" onClick={()=>{
          console.log(this.props);
          this.props.history.go(-1)
        }}>返回</div> : null}
        <div className="text">{title}</div>
        {register ? <Link to="/register" className="register">注册</Link> : null}
      </div>
    );
  }
}

export default withRouter(Header)